 package uk.co.mmscomputing.concurrent;
 
 public class Blocker extends Semaphore
 {
   protected int timeout;
 
   public Blocker()
   {
     super(0, true);
     this.timeout = 0;
   }
 
   public Blocker(int paramInt) {
     super(0, true);
     this.timeout = paramInt;
   }
 
   public void block() throws InterruptedException {
     if (this.timeout <= 0)
       acquire();
     else
       tryAcquire(this.timeout, TimeUnit.MILLISECONDS);
   }
 
   public void acquire() throws InterruptedException
   {
     super.acquire();
     release();
   }
 
   public boolean tryAcquire(long paramLong, TimeUnit paramTimeUnit) throws InterruptedException {
     boolean bool = super.tryAcquire(paramLong, paramTimeUnit);
     release();
     return bool;
   }
 }

